# _*_ coding:utf-8 _*_
from captcha.fields import CaptchaField
from django import forms


# 业务处理
# 激活时验证码实现
class ActiveForm(forms.Form):
    # 激活时不对邮箱密码做验证
    # 应用验证码 自定义错误输出key必须与异常一样
    captcha = CaptchaField(error_messages={"invalid": u"验证码错误"})


#检查前端输入的数据 用户名 密码
class LoginForm(forms.Form):
    username = forms.CharField(required = True, min_length= 5)
    password = forms.CharField(required = True, min_length= 5)


class PersonalForm(forms.Form):
    username_per = forms.CharField(required=True, min_length=5)
    password_per = forms.CharField(required=True, min_length=5)


#检查前端输入的数据 用户名 密码 验证码
class RegisterForm(forms.Form):
    email = forms.EmailField(required=True)
    password = forms.CharField(required=True, min_length=5)
    captcha = CaptchaField(error_messages={"invalid": u"验证码错误！"})


#找回密码
class ForgetForm(forms.Form):
    email = forms.EmailField(required=True)
    captcha = CaptchaField(error_messages={"invalid": u"验证码错误！"})


#重置密码
class ModifyPwdForm(forms.Form):
    email = forms.EmailField(required=True)
    password1 = forms.CharField(required=True, min_length=5)
    password2 = forms.CharField(required=True, min_length=5)


